define(['knockout', 'durandal/app'], function(ko, app) {
	var activeViewData = {
		left: 'app-main/doc/nav-panel/left/index',
		middle: 'app-main/doc/nav-panel/middle/index',
		right: 'app-main/doc/nav-panel/right/index'
	}

	var Panel = function(name, id, index) {
		var obj = {
			name: name,
			id: id,
			index: index
		}
		return obj;
	}

	var panels = ko.observableArray([new Panel('left', 0, 0), new Panel('middle', 1, 1), new Panel('right', 2, 2)]);
	var activeView = ko.observable(activeViewData.left);
	var activeItem = ko.observable(panels()[0]);
	var activationData = {
		activeView: activeView,
		activeItem: activeItem
	}
	var onItemClick = function(item, event) {
		debugger;
		activeItem(item);
		activeView(activeViewData[item.name]);
		app.trigger('nav-panel:selected-item:update', item);
	}
	return {
		activeView: activeView,
		activeItem: activeItem,
		activationData: activationData,
		panels: panels,
		onItemClick: onItemClick
	}
});